<!DOCTYPE html>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<script>

async_test(function(t) {
    var image = document.createElement('img');
    image.src = 'http://localhost:8080/security/resources/abe.png';
    image.addEventListener('load', function() {
        var offscreenCanvas = new OffscreenCanvas(10, 10);
        var ctx = offscreenCanvas.getContext('2d');
        ctx.drawImage(image, 0, 0);
        offscreenCanvas.convertToBlob().then(t.step_func_done(function() {
            assert_false("convertToBlob on a tainted OffscreenCanvas didn't throw, but should be");
        }), t.step_func_done(function(e) {
            assert_true(e instanceof DOMException);
            assert_equals(e.name, "SecurityError");
        }));
    });
}, "Test that call convertToBlob on a tainted OffscreenCanvas throws exception");

</script>

